package cn.lovemmd.model.admin.common;

import lombok.experimental.UtilityClass;

import java.util.HashMap;
import java.util.Map;

/**
 * 模型工具类
 * 展示Lombok的@UtilityClass用法
 * 
 * @author TLS
 * @since 2024-01-01
 */
@UtilityClass
public class ModelUtils {

    /**
     * 职业映射表
     */
    private static final Map<String, String> OCCUPATION_MAP = new HashMap<>();

    static {
        OCCUPATION_MAP.put("bladePoint", "刀锋");
        OCCUPATION_MAP.put("Flame", "烈焰");
        OCCUPATION_MAP.put("doubleGun", "双枪");
        OCCUPATION_MAP.put("machineGun", "机枪");
        OCCUPATION_MAP.put("guidedMissile", "导弹");
        OCCUPATION_MAP.put("sniper", "狙击");
        OCCUPATION_MAP.put("medic", "医生");
        OCCUPATION_MAP.put("grenade", "榴弹");
        OCCUPATION_MAP.put("engineer", "工程师");
    }

    /**
     * 获取职业中文名称
     * 
     * @param occupation 职业代码
     * @return 职业中文名称
     */
    public static String getOccupationName(String occupation) {
        return OCCUPATION_MAP.getOrDefault(occupation, occupation);
    }

    /**
     * 验证职业代码是否有效
     * 
     * @param occupation 职业代码
     * @return 是否有效
     */
    public static boolean isValidOccupation(String occupation) {
        return OCCUPATION_MAP.containsKey(occupation);
    }

    /**
     * 获取所有职业代码
     * 
     * @return 职业代码数组
     */
    public static String[] getAllOccupations() {
        return OCCUPATION_MAP.keySet().toArray(new String[0]);
    }
}
